<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function mul(){
				var num1=document.getElementById("num1").value;
				var num2=document.getElementById("num2").value;
				var num3=num1*num2;
				document.getElementById("num3").value=num3;
			}
			function div(){
				var num1=document.getElementById("num1").value;
				var num2=document.getElementById("num2").value;
				if(num2==0){
					alert("除数不能为0！");
					return;
				}
				var num3=num1/num2;
				document.getElementById("num3").value=num3;
			}
			function jianfa(){
				var num1=document.getElementById("num1").value;
				var num2=document.getElementById("num2").value;
				if(isNaN(num1)||isNaN(num2)){
					alert("运算数据不能为非数字");
					return;
				}
				var num3=num1-num2;
				document.getElementById("num3").value=num3;
			}
			function add(){
				var num1=document.getElementById("num1").value-0;
				var num2=document.getElementById("num2").value-0;
				if(isNaN(num1)||isNaN(num2)){
					alert("运算数据不能为非数字");
					return;
				}
				var num3=num1+num2;
				num3=num3.toFixed(15)-0;//
				document.getElementById("num3").value=num3;
			}
		</script>
	</head>
	<body>
		第一个数：<input type="text" id="num1" />
		<br>
		第二个数：<input type="text" id="num2" />
		<br>
		<button onclick="add()">+</button>
		<button onclick="jianfa()">-</button>
		<button onclick="mul()">*</button>
		<button onclick="div()">/</button>
		<br>
		计算结果：<input type="text" id="num3" disabled="disabled"/>
	</body>
</html>
